from django.shortcuts import render
import requests
from django.http import HttpResponse
import json

# Create your views here.
def get163News(request):
    r = requests.get('http://mobile.163.com/special/index_datalist/', timeout=20)
    r.encoding = 'utf-8'
    l = r.text[14:-1].decode("utf-8")
    print(l)
    # for i in l:
    #     print(i)
    #     break
    return HttpResponse(json.dumps({'code': 0, 'msg': l}), content_type="application/json")